﻿<?
session_start();
include('/config/config.php');
$file = file ($pdirr."/record.php");
$mmsg = file_get_contents($pdirr."/record.php");
if(!isset($mmsg) or $mmsg==''){$blog_ms_out = '<tr><td id="tr">Записей нет.</td></tr>';}
$i=1;
foreach ($file as $e)
{
    $elem = explode ("|||", $e);
    $blog_ms = $msg_sh;
	if ($elem[2]!='' or isset($elem[2])){
    $elem[1] = htmlspecialchars($elem[1]);
	$elem[0] = htmlspecialchars($elem[0]);
	$elem[1] = str_replace ("{%}", "<br />", $elem[1]);
	$elem[1] = str_replace ("(с)", "&copy;", $elem[1]);
	$elem[1] = str_replace ("(c)", "&copy;", $elem[1]);
	$elem[1] = preg_replace ($regular['3'], "<a href=\"?prof=$1\">$1</a>", $elem[1]);
	$elem[1] = preg_replace ($regular['4'], "prof=", $elem[1]);
	$elem[1] = preg_replace($regular['1'],"<a href=\"$1\" target=\"_blank\">$1</a>",$elem[1]);
	$elem[1] = preg_replace($regular['2'],"<a href=\"http://$1\" target=\"_blank\">$1</a>",$elem[1]);
    $blog_ms = str_replace ("%IMG%", $elem[0], $blog_ms);
    $blog_ms = str_replace ("%DATE%", $elem[2], $blog_ms);
    $blog_ms = str_replace ("%MSG%", $elem[1],$blog_ms);
    $blog_ms = str_replace ("%ID%", $elem[3],$blog_ms);
	if($_SESSION['logmit']!=$name or !isset($_SESSION['logmit'])){$blog_ms = str_replace ("%DEL%", '',$blog_ms);}else{
	$blog_ms = str_replace ("%DEL%", '<a href="/delite" rel="'.$elem[3].'">Удалить</a>',$blog_ms);
	}
	} else { $blog_ms=''; }
    $blog_ms_out = $blog_ms_out . $blog_ms;
	$get = htmlspecialchars($_GET['do']);
    if($get!='arhive'){
        if ($i>=$max_p){break;}
    }
    $i++;
}

?>